农夫约翰的奶酪块
题目 农夫约翰的奶酪块
思路分析
代码实现
#include<bits/stdc++.h
using namespace std;
#define endl '\n'
const int N=1010;
int n,Q;
int X[N][N],Y[N][N],Z[N][N];
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>Q;
int res=0;
while(Q--){
int x,y,z;
cin>>x>>y>>z;
X[x][y]++;
Y[y][z]++;
Z[x][z]++;
if(X[x][y]>=n) res++;
if(Y[y][z]>=n) res++;
if(Z[x][z]>=n) res++;
cout<<res<<endl;
}
return 0;
}
💬 评论